/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

body::-webkit-scrollbar, html::-webkit-scrollbar {
    display: none;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
}

.app-header {
    background-color: #007bff;
    color: white;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 100;
    flex-shrink: 0;
}

.app-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: #fff;
    width: 100%;
    height: 100%;
}

#contentFrame {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.3s ease-in-out;
    overflow: hidden;
}

/* 动画效果 */
@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideOut {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

/* iframe定位和动画样式 - 优化缓存机制，避免重渲染 */
iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 1;
    /* 关键优化：使用visibility而非display来保持渲染状态 */
    opacity: 0;
    visibility: hidden;
    transition: none;
    pointer-events: none;
}

iframe.active {
    z-index: 10;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* 动画相关样式 */
.slide-in {
    animation: slideIn 0.3s ease-out forwards;
}

.slide-out {
    animation: slideOut 0.3s ease-out forwards;
    opacity: 0;
    visibility: hidden;
    z-index: 1;
    pointer-events: none;
}

.bottom-nav {
    background-color: #fff;
    width: 100%;
    height: 60px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    padding: 8px 0;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
    border-top: 1px solid #ddd;
}

.bottom-nav ul {
    display: flex;
    justify-content: space-around;
    list-style: none;
    height: 100%;
    margin: 0;
    padding: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
    flex: 1;
    height: 100%;
    justify-content: center;
}

.nav-item.active {
    color: #007bff;
    opacity: 1;
    background-color: #f0f8ff;
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 2px;
}

.nav-text {
    font-size: 12px;
    margin-top: 4px;
}

/* 设置面板样式 */
.settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.settings-header h2 {
    margin: 0;
    font-size: 20px;
}

#close-settings {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.setting-item select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    background-color: white;
}

.setting-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
}

.setting-buttons button {
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#export-config {
    background-color: #007bff;
    color: white;
}

#import-config {
    background-color: #28a745;
    color: white;
}

#reset-config {
    background-color: #dc3545;
    color: white;
}

.setting-buttons button:hover {
    opacity: 0.9;
}

.offline-status {
    margin-top: 30px;
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    background-color: #f8f9fa;
}

#connection-status.online {
    color: #28a745;
}

#connection-status.offline {
    color: #dc3545;
}

/* 深色主题支持 */
.dark-theme {
    background-color: #121212;
    color: #f5f5f5;
}

.dark-theme .settings-panel {
    background-color: #1e1e1e;
}

.dark-theme .setting-item label {
    color: #f5f5f5;
}

.dark-theme .setting-item select {
    background-color: #333;
    color: #f5f5f5;
    border-color: #555;
}

.dark-theme .settings-header {
    border-color: #444;
}

.dark-theme .offline-status {
    background-color: #2c2c2c;
}

/* AI 炫彩球形样式 */
.ai-globe {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #feca57, #48dbfb, #1dd1a1, #5f27cd, #ff6b6b);
    background-size: 400% 400%;
    animation: gradientAnimation 3s ease infinite;
    position: relative;
}

.ai-globe::before {
    content: '🤖';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    z-index: 1;
}

@keyframes gradientAnimation {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 响应式设计 - 确保在所有设备上都正确显示 */
@media (min-width: 768px) {
    /* 底部导航始终显示 */
    .app-content {
        height: calc(100vh - 64px - 60px); /* 减去header和nav的高度 */
    }
}

@media (max-width: 767px) {
    .app-header h1 {
        font-size: 20px;
    }
}

/* 深色主题 */
body.dark-theme {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-theme .app-header {
    background-color: #2a2a2a;
    color: #e0e0e0;
}

body.dark-theme .bottom-nav {
    background-color: #2d2d2d;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    border-top: 1px solid #444;
}

body.dark-theme .app-content {
    background-color: #1e1e1e;
}

body.dark-theme .nav-item.active {
    color: #66b3ff;
    background-color: #3a3a3a;
}